const div1 = document.getElementById('div1')
const div2 = document.getElementById('div2')

//create new node
const newP = document.createElement('p')
newP.innerHTML = ' this is newP'

//insert node
div1.appendChild(newP)

//移动节点
// const p1 = document.getElementsByTagName('div')[0]
// // console.log(p1);
// div2.appendChild(p1)

//获取父节点
console.log(newP.parentNode);

//获取子元素列表
const div1ChildNodesP = Array.prototype.slice.call(div1.childNodes).filter(child => {
  if(child.nodeType === 1 ) {
    return true
  }
  return false
})
console.log('div1ChildNodesP',div1ChildNodesP);

// 删除节点
div1.removeChild(div1ChildNodesP[0])
